<?php

namespace app\index\controller;

use think\Controller;
use  think\Route;
use think\Db;
use app\common\func\allRequest;

class Index extends Controller
{
    public function index()
    {
        $res4=db('category')->where('pid',0)->field('id,cname')->select();
        $res1 =Db::table('lamp_txt')
        ->alias('txt')
        ->join('lamp_category cate', 'cate.id  = txt.cid and txt.hot=0')
        ->field('cate.cname,txt.id,txt.name,txt.desc,txt.photo,txt.zuozhe,txt.end,txt.addtime,txt.hot')
        ->select();
        $res2 =Db::table('lamp_txt')
            ->alias('txt')
            ->join('lamp_category cate', 'cate.id  = txt.cid and txt.end = 0')
            ->field('cate.cname,txt.id,txt.name,txt.desc,txt.photo,txt.zuozhe,txt.end,txt.addtime,txt.hot')
            ->select();
        $res3=db('images')->where('statu','0')->limit(3)->select();

//        $you = db('friendship')->where('status = 1')->select();
        // var_dump($you);die;
//        dump($res3);die;

        return view('index/index',['data4'=>$res4,'data1'=>$res1,'data2'=>$res2,'data3'=>$res3]);
    }


    public function luyou(){
        $url="http://192.168.12.61/qq";
        $urlreq=new allRequest();
        $msg=$urlreq->curl_request($url);

        return json_decode($msg);
//        dump($msg);exit;
//        dump(json_decode($msg));exit;
    }
}
